package com.interview.function;

public class MethodDemo {

    public static void main(String[] args) {
        int a = 10;
        int b = 20;

        // 求和
        int result = sum(a, b);
        System.out.println("result:" + result);

        int c = 30;
        // 求和
        //int result2 = sum2(a,b,c);
        //System.out.println("result2:"+result2);
        result = sum(a,b,c);
        System.out.println("result:"+result);
    }


    //两个float类型的数据求和
    public static float sum(float a,float b) {
        return a + b;
    }

    // 三个整数的求和
    public static int sum(int a,int b,int c) {
        return a + b + c;
    }

	/*
	public static int sum2(int a, int b, int c) {
		return a + b + c;
	}
	*/

    // 两个整数的求和
    public static int sum(int a, int b) {
        return a + b;
    }

}
